<?php
    $this->load->view("fungsiPenting.php");
    
    foreach($getDetail as $a){
        $aId   			= $a["SIK_ID"];
		$aNik   		= $a["SIK_NIK"];
		$aSdate   		= $a["SIK_SDATE"];
		$aEdate   		= $a["SIK_EDATE"];
		$aShours   		= $a["SHOURS"];
		$aEhours   		= $a["EHOURS"];
		$aShoure   		= $a["SHOURE"];
		$aEhoure   		= $a["EHOURE"];
		$aVendorId   	= $a["VENDOR_ID"];
		$aVendorName   	= $a["VENDOR_NAME"];
		$aVendorJabatan = $a["VENDOR_JABATAN"];
		$aVendorPic   	= $a["VENDOR_PIC"];		
		$aUntukNik   	= $a["SIK_UNTUK_NIK"];
		$aComment   	= $a["SIK_GA_COMMENT"];
		
		$aSikAtasanNik  = $a["SIK_ATASAN_NIK"];
		$aSikAtasanName = $a["ATASANNAME"];		
		$cName				= $a["NIKNAME"];
		$cJob				= $a["NIKJOBPOSITION"];
		$cOrg				= $a["NIKORG"];
    }
    foreach($getDetailPhone as $a){
        $aMsisdn = $a['MSISDN'];
    }
?>
<!--
<div class="container" style="margin-top:40px">
-->
	<div class="col-md-offset-0" id="top">
	<div class="col-md-11">
	<div id="report" class="panel panel-default">
		<div class="panel-heading">
		<h4 class="panel-title"><b> Surat Ijin Kerja</b></h4>
		
		<div class="btn-group pull-right">
			<button class="btn btn-default btn-sm" id="btnExport"><i class="icon-file-excel on-left"></i> Excel</button>
			<button class="btn btn-default btn-sm" type='button' value='Print' onclick="printDiv('tblExport');"><i class="icon-printer on-left"></i> Print</button>
		</div>
		
		</div>
		<div class="panel-body" id="tblExport">	
			<div class="row">
				<div class="col-sm-4">
					<img class="img-responsive" src="<?php echo base_url() ?>static/images/logo_telkomsel.png">
				</div>
				<div class="col-sm-4" align="center">
                    <h3>
                    <?php echo $cRequestNo;?>
                    </h3>
				</div>
				<div class="col-sm-4"></div>
			</div>
			<br />
			
			<div class="row">
				<div class="col-sm-12">
					<div class="table-responsive" style="border: none;">
						<table class="table" style="border: none;">
                        <!--<table>-->
							
							<tr>
								<td width="30%">No Order</td>           <td width="5%">:</td>         <td width="65%"><?php echo $cRequestNo;?></td>
                            </tr>
                            <tr>    
								<td width="30%">Nik</td>                <td width="5%">:</td>         <td width="65%"><?php echo $aUntukNik;?></td>
                            </tr>
                            <tr>
								<td width="30%">Nama</td>               <td width="5%">:</td>         <td width="65%"><?php echo $cName;?></td>
                            </tr>
                            <tr>    
                                <td width="30%">No. Hp</td>             <td width="5%">:</td>         <td width="65%"><?php echo $aMsisdn;?></td>
                            </tr>
                            <tr>    
                                <td width="30%">Departemen</td>         <td width="5%">:</td>         <td width="65%"><?php echo $cOrg;?></td>
                            </tr>
                            <tr>    
                                <td width="30%">Job Position</td>       <td width="5%">:</td>         <td width="65%"><?php echo $cJob;?></td>
                            </tr>
                            <tr>
                                <td width="30%"></td>                   <td width="5%"></td>         <td width="65%"></td>
                            </tr>
                            <tr>
                                <td width="30%">Kontraktor</td>         <td width="5%">:</td>         <td width="65%"><?php echo $aVendorName;?></td>
                            </tr>
                            <tr>
                                <td width="30%">PIC</td>                <td width="5%">:</td>         <td width="65%"><?php echo $aVendorPic;?></td>
                            </tr>
                            <tr>
                                <td width="30%">Jabatan</td>            <td width="5%">:</td>         <td width="65%"><?php echo $aVendorJabatan;?></td>
                            </tr>
                            <tr>
                                <td width="30%">Tgl Pekerjaan</td>      <td width="5%">:</td>         <td width="65%"><?php echo $aSdate." - ".$aEdate;?></td>
                            </tr>
                            <tr>
                                <td width="30%">Jam Pekerjaan</td>      <td width="5%">:</td>         <td width="65%"><?php echo $aShours.":".$aEhours." - ".$aShoure.":".$aEhoure;?></td>
                            </tr>
                            <tr>
                                <td width="30%">Keterangan</td>         <td width="5%">:</td>         <td width="65%">
                                    <div class="table-responsive" style="border: none;">
						                  <table class="table" style="border: none;">
                                                <tr>
                                                    <td>No</td>
                                                    <td>Nama</td>
                                                    <td>Pekerjaan</td>
                                                    <td>Lantai</td>
                                                    <td>Location</td>
                                                    <td>Access</td>
                                                    <td>Nama Barang</td>
                                                    <td>S/N</td>
                                                </tr>
                                                <?php
                                                $i_job=0;
                                                $no_job=1;
                                                foreach($getDetailName as $b){
                                                    $bId   		= $b["SIKJ_ID"];			
                            						$bName  	= $b["SIKJ_NAME"];
                            						$bPekerjaan = $b["SIKJ_DESC"];
                            						$bLantai    = $b["SIKJ_FLOOR"];
                            						$bLocation  = $b["SIKJ_LOCATION"];
                            						$bAccess    = $b["SIKJ_ACCESS"];
                            						$bBarang    = $b["SIKJ_BARANG"];
                            						$bSn  		= $b["SIKJ_SN"];
                                                ?>
                                                <tr>
                                                    <td><?php echo $no_job;?></td>
                                                    <td><?php echo $bName;?></td>
                                                    <td><?php echo $bPekerjaan;?></td>
                                                    <td><?php echo $bLantai;?></td>
                                                    <td><?php echo $bLocation;?></td>
                                                    <td><?php echo $bAccess;?></td>
                                                    <td><?php echo $bBarang;?></td>
                                                    <td><?php echo $bSn;?></td>
                                                </tr>
                                                <?php
                                                    $i_job++;
                                                    $no_job++;
                                                }
                                                ?>
                                          </table>
                                    </div>                                
                                </td>
                            </tr>
                            <tr>
                                <td width="30%">Nama Atasan</td>            <td width="5%">:</td>         <td width="65%"><?php echo $aSikAtasanName;?></td>
                            </tr>
                            <tr>
                                <td width="30%">Comment</td>                <td width="5%">:</td>         <td width="65%"><?php echo nl2br($aComment);?></td>
                            </tr>
						</table>
					</div>
					
				</div>
			</div>
			
		</div>
	</div>
	</div>
	</div>
<!--</div>-->

<script>
	$(function() {
		$("input[id^='datepicker']").datetimepicker({
			scrollInput: false,
			yearOffset:0,
			lang:'en',
			timepicker:false,
			datepicker:true,
			format:'d-m-Y',
			formatDate:'d/m/Y',
			/*minDate:'-1970/01/01',
			onGenerate:function( ct ){
				$(this).find('.xdsoft_date.xdsoft_weekend')
					.addClass('xdsoft_disabled');
			}*/
		});
	});
</script>
<script>
    $(document).ready(function () {
        $("#btnExport").click(function () {
            $("#tblExport").btechco_excelexport({
                containerid: "tblExport"
               , datatype: $datatype.Table
               , filename: 'Report_Coordination_<?php echo str_replace("-","",$this->input->post('date_start'))."-".str_replace("-","",$this->input->post('date_end')); ?>'
            });
			
        });
		
    });
</script>
<script>
	function printDiv(divName) 
	{
		var printContents = document.getElementById(divName).innerHTML;     
		var originalContents = document.body.innerHTML;       
		document.body.innerHTML = printContents;      
		window.print();      
		document.body.innerHTML = originalContents;
		window.parent.reload();
   }
</script>
<style type="text/css">
table { border-collapse:collapse; width:100%;}
table td, table th { border:1px solid #ddd; padding:2px; }

table { page-break-inside:auto }
tr    { page-break-inside:avoid; page-break-after:auto }
thead { display:table-header-group }
tfoot { display:table-footer-group }

.table > tbody > tr > td {
	padding: 3px;
}
</style>

